package com.example.demo.repository;

import com.example.demo.entity.Notice;
import com.example.demo.entity.Notice_recption;
import com.example.demo.utils.PlannerCache;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface Notice_recptionRepository extends JpaRepository<Notice_recption,Integer> {

    @Query(value = "SELECT * FROM notice_recption WHERE notice_id = %?1 ;",nativeQuery = true)
    List<Notice_recption> findAllByNoticeId(Integer id);

    @Query(value = "SELECT * FROM notice_recption WHERE notice_id = %?1 AND user_id = %?2 ;",nativeQuery = true)
    Notice_recption findByNoticeIdAndUserId(Integer noticeid, Integer userid);


    @Query(value = "SELECT * FROM notice_recption WHERE activity_id = %?1 ;",nativeQuery = true)
    List<Notice_recption> findAllByActivityId(Integer activityId);

    @Query(value = "SELECT * FROM notice_recption WHERE user_id = %?1 ;",nativeQuery = true)
    List<Notice_recption> findByUserId(Integer userId);

}
